package com.xiaoxu.intranetweb.mybatisplusSzappdb.business.ashGate;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.entity.TArea;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.service.ITAreaService;
import com.xiaoxu.intranetweb.util.SzResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 库类型业务层
 * @author xiaoxu
 * @date 2023/1/13 15:00
 * @version 1.0
 * @since 1.0
 */
@Component
public class AreaBu {
    @Autowired
    private ITAreaService areaService;
    public SzResult getArea(String areaName,String plantId) {
//        查询拿到所有的area
        QueryWrapper<TArea> queryWrapper = new QueryWrapper<>();
//        拿到所有
        queryWrapper.eq(areaName !=null && areaName.equals(""),"AREA_NAME",areaName);
        queryWrapper.eq("DEL_FLAG",0);
        queryWrapper.eq("DATA_FROM",plantId);
        queryWrapper.orderByDesc("ID");
        List<TArea> list =  areaService.list(queryWrapper);
        return SzResult.success(list);
    }
}
